<?php

// 获取活动详情(后台)
// GET activity.admin.get

namespace app\api\resource\activity\admin;
use think\Db;

class Get
{
    // 方法
    public $_method = ['GET'];
    // 前置
    public $_pre    = ['adminLogin'];
    // 描述
    public $_description = '获取活动详情(后台)';
    // 参数
    public $_param  = [
        'id' => '活动主键',
    ];
    // 返回
    public $_return = [
        200 => '获取成功',
        422 => '活动主键必须',
        404 => '活动不存在',
    ];

    public function run(&$request)
    {
        $id = $request->get('id/d',0);

        if (0 == $id) return [422,'活动主键必须'];
        
        $activity = Db::name('activity')->where('id',$id)->find();

        return [200,$activity];
    }
}